<template>
  <ant-modal
    modalWidth="576"
    modalHeight="500"
    :visible="open"
    :modal-title="formTitle"
    :adjust-size="true"
    @cancel="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" slot="content" layout="vertical">
      <a-row :gutter="32">
        <a-col :span="12" >
          <a-form-model-item label="客户类别" prop="customerCategory">
            <a-select
              placeholder="请选择客户类别"
              v-model="form.customerCategory"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear>
              <a-select-option v-for="(d, index) in customerCategoryOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="客户编码" >
            <a-input v-model="form.customerCode" placeholder="客户编码自动生成" disabled/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="客户名称" prop="customerName">
            <a-input v-model="form.customerName" placeholder="请输入客户名称"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="助记码" >
            <a-input v-model="form.mnemonicCode" placeholder="请输入助记码"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12" >
          <a-form-model-item label="清账发货" prop="isClear">
            <a-radio-group v-model="form.isClear" button-style="solid">
              <a-radio-button
                v-for="(dict, index) in isClearOptions"
                :key="index"
                :value="dict.dictValue"
              >
                {{ dict.dictLabel }}
              </a-radio-button>
            </a-radio-group>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="联系电话" >
            <a-input v-model="form.phone" placeholder="请输入联系电话"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="联系人" >
            <a-input v-model="form.contactPerson" placeholder="请输入联系人"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12" >
          <a-form-model-item label="售价模式" prop="sellMode">
            <a-select
              placeholder="请选择售价模式"
              v-model="form.sellMode"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear>
              <a-select-option v-for="(d, index) in sellModeOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="12" >
          <a-form-model-item label="业务员">
            <select-user
              v-model="form.customernan"
              select-model="single"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="描述" prop="remark">
            <a-textarea v-model="form.remark" placeholder="请输入描述" :rows="4"/>
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
    <template slot="footer">
      <a-button :disabled="disabled" @click="cancel">
        取消
      </a-button>
      <a-button type="primary" :disabled="disabled" @click="submitForm(true)">
        保存
      </a-button>
    </template>
  </ant-modal>
</template>
<script>
import BizCustomerAddForm from './BizCustomerForm'
export default {
  ...BizCustomerAddForm
}
</script>
